<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

<script>

// startsWith(xx)判断字符串是否以xx开头，返回布尔值
// endsWith(xx)判断字符串是否以xx结尾，返回布尔值
let str = 'abc123';

console.log( str.startsWith('a') );// true
console.log( str.startsWith('ab') );// true
console.log( str.startsWith('bc') );// false

console.log( str.endsWith('3') );// true
console.log( str.endsWith('23') );// true
console.log( str.endsWith('12') );// false

</script>
</body>
</html>